﻿using System;
using System.Windows;
using System.Windows.Input;
using SnakeGame.Models;
using SnakeGame.ViewModels;
using SnakeGame.Helpers;

namespace SnakeGame.Views
{
    /// <summary>
    /// Interaction logic for WinnerWindow.xaml
    /// </summary>
    public partial class WinnerWindow : Window
    {
        public WinnerWindowViewModel _winViewModel;
        public WinnerWindow()
        {
            InitializeComponent();
        }

        public void Initialize(MainFrame mainFrame, Player p)
        {
            _winViewModel = new WinnerWindowViewModel();
            _winViewModel.RequestClose += _winViewModel_RequestClose;
            _winViewModel.Initialize(p);
            DataContext = _winViewModel;
        }

        void _winViewModel_RequestClose(object sender, System.EventArgs e)
        {
            Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MyMediaPlayer MediaPlayer = new MyMediaPlayer();
            MediaPlayer.Open(new Uri("winner.wav", UriKind.Relative));
            MediaPlayer.Play();

        }


    }
}
